// JavaScript Document// JavaScript Document
var error = "";
				var catName="";
				var catDesc="";
function validateForm2(strURL,formname,responsediv,responsemsg) {
				error = "";
				var _boolForm = 0;
				var emptyPreMessge = "You must include an accurate";
				var emptyPostMessge = "for a response";
				//var "Invalid E-mail ID" = "Invalid E-mail ID"

				
				catName=document.forms["frmCategory"]["txtCategoryName"].value;
				catDesc=document.forms["frmCategory"]["textDescription"].value;

				
				
				//alert(catName);
				document.getElementById("status").innerHTML	= "";
				
				
				var nameError = "";
				if(catName == "" || catName == null)
				{
					document.forms["frmCategory"]["txtCategoryName"].focus();
					error = "Name must not be empty";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
				}
				else if(lengthRestriction(catName,3,25) == true)
				{
					
					if(isAlphabet(catName) == true)
					{
						_boolForm = 1;  // if valid bool setting to zero check other fields
					}
					else
					{
						document.forms["frmCategory"]["txtCategoryName"].focus();
						error = "Name must contain only letters";
						document.getElementById("status").innerHTML	= error;
						return false;
					}
				}
				else
				{
					document.forms["frmCategory"]["txtCategoryName"].focus();
					error = "Please enter the Name between " +3+ " and " +25+ " characters";
					document.getElementById("status").innerHTML	= error;
					return false;
				}
				
				if(_boolForm == 1)
				{
					//alert('ok')
			document.getElementById("frmCategory").submit();
			
			}
					
	
			else
			return false;
				
}

function getTinyFormQuerystring() {

   var qstr = "name="+catName+"&desc="+catDesc;
	alert(qstr);
    return qstr;

}

function updatepage(str,responsediv){

    document.getElementById(responsediv).innerHTML = str;

}


function updatepage(str,responsediv){
    document.getElementById(responsediv).innerHTML = str;
}


	
function lengthRestriction(str, min, max){
	if(str.length >= min && str.length <= max){
		return true;
	}else{
		document.forms["frmCategory"]["txtCategoryName"].focus();
		error = "Please enter the Name between " +min+ " and " +max+ " characters";
		document.getElementById("status").innerHTML	= error;
		return false;
	}
}

function isAlphabet(str){
	var alphaExp = /^[a-zA-Z-_ .',]+$/;
	if(str.match(alphaExp)){
		return true;
	}else{
		document.forms["frmCategory"]["txtCategoryName"].focus();
		error = "Name must contain only letters";
		document.getElementById("status").innerHTML	= error;
		return false;
	}
}

function show_image() {
    var img = document.createElement("IMG");
    img.src = "Small Alert Icon.png";
	document.getElementById('status').appendChild(img);
}



